package com.ikas.ai.server.module.morningpaper.consts;

import com.google.common.collect.Lists;
import com.ikas.ai.consts.MachineAndWorkConditionConst;

import java.util.List;

/**
 * 统计字段基础集合
 */
public enum MorningPaperNormalVariableNames {

    /**
     * 机组优先级
     */
    machinePriority("机组优先级", null, null),
    /**
     * 机组当日启动次数
     */
    machineWholePowerUpCount("机组当日启动次数", null, null),
    /**
     * 当日1机组工况G运行总次数
     */
    machineU01ConditionGPowerUpCount("当日1机组工况G运行总次数", "1CRK00_MODE_DZ_G", 1206L),
    /**
     * 当日1机组工况G运行总小时
     */
    machineU01ConditionGPowerUpHours("当日1机组工况G运行总小时", "1CRK00_MODE_DZ_G", 1206L),
    machineU01ConditionPPowerUpCount("当日1机组工况P运行总小时", "1CRK00_MODE_DZ_P", 1195L),
    machineU01ConditionPPowerUpHours("当日1机组工况P运行总小时", "1CRK00_MODE_DZ_P", 1195L),
    machineU01ConditionPCPowerUpCount("当日1机组工况PC运行总小时", "1CRK00_MODE_DZ_PC", 1188L),
    machineU01ConditionPCPowerUpHours("当日1机组工况PC运行总小时", "1CRK00_MODE_DZ_PC", 1188L),
    machineU02ConditionGPowerUpCount("当日2机组工况G运行总小时", "2CRK00_MODE_DZ_G", 7357L),
    machineU02ConditionGPowerUpHours("当日2机组工况G运行总小时", "2CRK00_MODE_DZ_G", 7357L),
    machineU02ConditionPPowerUpCount("当日2机组工况P运行总小时", "2CRK00_MODE_DZ_P", 7346L),
    machineU02ConditionPPowerUpHours("当日2机组工况P运行总小时", "2CRK00_MODE_DZ_P", 7346L),
    machineU02ConditionPCPowerUpCount("当日2机组工况PC运行总小时", "2CRK00_MODE_DZ_PC", 7339L),
    machineU02ConditionPCPowerUpHours("当日2机组工况PC运行总小时", "2CRK00_MODE_DZ_PC", 7339L),
    machineU03ConditionGPowerUpCount("当日3机组工况G运行总小时", "3CRK00_MODE_DZ_G", 13529L),
    machineU03ConditionGPowerUpHours("当日3机组工况G运行总小时", "3CRK00_MODE_DZ_G", 13529L),
    machineU03ConditionPPowerUpCount("当日3机组工况P运行总小时", "3CRK00_MODE_DZ_P", 13518L),
    machineU03ConditionPPowerUpHours("当日3机组工况P运行总小时", "3CRK00_MODE_DZ_P", 13518L),
    machineU03ConditionPCPowerUpCount("当日3机组工况PC运行总小时", "3CRK00_MODE_DZ_PC", 13511L),
    machineU03ConditionPCPowerUpHours("当日3机组工况PC运行总小时", "3CRK00_MODE_DZ_PC", 13511L),
    machineU04ConditionGPowerUpCount("当日4机组工况G运行总小时", "4CRK00_MODE_DZ_G", 19710L),
    machineU04ConditionGPowerUpHours("当日4机组工况G运行总小时", "4CRK00_MODE_DZ_G", 19710L),
    machineU04ConditionPPowerUpCount("当日4机组工况P运行总小时", "4CRK00_MODE_DZ_P", 19699L),
    machineU04ConditionPPowerUpHours("当日4机组工况P运行总小时", "4CRK00_MODE_DZ_P", 19699L),
    machineU04ConditionPCPowerUpCount("当日4机组工况PC运行总小时", "4CRK00_MODE_DZ_PC", 19692L),
    machineU04ConditionPCPowerUpHours("当日4机组工况PC运行总小时", "4CRK00_MODE_DZ_PC", 19692L),
    /**
     * 上库水位
     */
    waterLevelUpperReservoirMetres("上库水位", "YCRK08_WL2_AI", 4777L),
    /**
     * 下库水位
     */
    waterLevelUnderReservoirMetres("下库水位", "YCRK09_WL2_AI", 4847L),
    /**
     * 总蓄水量
     */
    waterLevelTotalStorageCubicMetres("总蓄水量", null, null),
    /**
     * 水工建筑是否正常
     */
    waterBuildingInNormal("水工建筑是否正常", null, null),
    /**
     * 该时段上网电量
     */
    currentTimeOnGridEnergyTenThousandKwh("该时段上网电量", null, null),
    /**
     * 该时段用网电量
     */
    currentTimePowerConsumptionThousandKwh("该时段用网电量", null, null),
    /**
     * 全年用网电量
     */
    thisYearPowerConsumptionOneHundredMillionKwh("全年用网电量", null, null),
    /**
     * 全年上网电量
     */
    thisYearOnGridEnergyOneHundredMillionKwh("全年上网电量", null, null),

    /**
     * 工况G全年运行次数
     */
    conditionGInWholeYearCount("工况G全年运行次数", null, null),
    /**
     * 工况P全年运行次数
     */
    conditionPInWholeYearCount("工况P全年运行次数", null, null),
    /**
     * 工况PC全年运行次数
     */
    conditionPCInWholeYearCount("工况PC全年运行次数", null, null),
    /**
     * 工况G全年成功率
     */
    conditionGInWholeYearSuccessPercent("工况G全年成功率", null, null),
    /**
     * 工况P全年成功率
     */
    conditionPInWholeYearSuccessPercent("工况P全年成功率", null, null),
    /**
     * 工况PC全年成功率
     */
    conditionPCInWholeYearSuccessPercent("工况PC全年成功率", null, null),
    /**
     * 机组全年运行次数
     */
    machinePowerUpInWholeYearCount("机组全年运行次数", null, null);


    public static List<MorningPaperNormalVariableNames> getEnumByMachineNo(String machineNo) {
        if (MachineAndWorkConditionConst.MACHINE_01_NO.equals(machineNo)) {
            return Lists.newArrayList(machineU01ConditionGPowerUpCount,
                    machineU01ConditionGPowerUpHours,
                    machineU01ConditionPPowerUpCount,
                    machineU01ConditionPPowerUpHours,
                    machineU01ConditionPCPowerUpCount,
                    machineU01ConditionPCPowerUpHours);
        }

        if (MachineAndWorkConditionConst.MACHINE_02_NO.equals(machineNo)) {
            return Lists.newArrayList(machineU02ConditionGPowerUpCount,
                    machineU02ConditionGPowerUpHours,
                    machineU02ConditionPPowerUpCount,
                    machineU02ConditionPPowerUpHours,
                    machineU02ConditionPCPowerUpCount,
                    machineU02ConditionPCPowerUpHours);
        }

        if (MachineAndWorkConditionConst.MACHINE_03_NO.equals(machineNo)) {
            return Lists.newArrayList(machineU03ConditionGPowerUpCount,
                    machineU03ConditionGPowerUpHours,
                    machineU03ConditionPPowerUpCount,
                    machineU03ConditionPPowerUpHours,
                    machineU03ConditionPCPowerUpCount,
                    machineU03ConditionPCPowerUpHours);
        }

        if (MachineAndWorkConditionConst.MACHINE_04_NO.equals(machineNo)) {
            return Lists.newArrayList(machineU04ConditionGPowerUpCount,
                    machineU04ConditionGPowerUpHours,
                    machineU04ConditionPPowerUpCount,
                    machineU04ConditionPPowerUpHours,
                    machineU04ConditionPCPowerUpCount,
                    machineU04ConditionPCPowerUpHours);
        }
        return Lists.newArrayList();
    }

    private String desc;
    private String meteCode;
    private Long meteId;

    MorningPaperNormalVariableNames(String desc, String meteCode, Long meteId) {
        this.desc = desc;
        this.meteCode = meteCode;
        this.meteId = meteId;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getMeteCode() {
        return meteCode;
    }

    public void setMeteCode(String meteCode) {
        this.meteCode = meteCode;
    }

    public Long getMeteId() {
        return meteId;
    }

    public void setMeteId(Long meteId) {
        this.meteId = meteId;
    }

    public static MorningPaperNormalVariableNames getByCode(String code) {
        for (MorningPaperNormalVariableNames myEnum : MorningPaperNormalVariableNames.values()) {
            if (myEnum.name().equals(code)) {
                return myEnum;
            }
        }
        return null;
    }
}
